package field

import "gitee.com/yanwc/net/utils"

type (
	ProtocolVersion    U1    // 协议版本0x00
	ProtocolVersionRaw U1Raw // 协议版本0x00
)

func (v ProtocolVersion) Raw() (out ProtocolVersionRaw) {
	copy(out[:], utils.NumberToBytesWithBigEndian(v))
	return
}

func (v ProtocolVersionRaw) Type() ProtocolVersion {
	return utils.BytesToNumber[ProtocolVersion](v[:])
}

func (v ProtocolVersionRaw) Slice() []byte {
	return v[:]
}
